
using Youz.Common.Helper;
using Youz.Common.DAL;
using Youz.Common.Entity;
using System;
using System.Data;
using System.Data.SqlClient;

namespace Youz.Common.BLL
{
	/// <summary>
	/// Sys_AdminInfo BLL Class
	/// </summary>
	public partial class Sys_AdminInfoBLL : BaseBLL
	{
		Sys_AdminInfoDAL dal;
		
		public Sys_AdminInfoBLL()
		{
			dal = new Sys_AdminInfoDAL();
			base.MenuName = "安全管理";
			base.ModuleName = "管理員管理";
		}

		/// <summary>
		/// 是否存在该记录
		/// </summary>
		public bool ExistsByUserNameAndEmail(string MemberAccount, string Email)
		{
			return dal.ExistsByUserNameAndEmail(MemberAccount, Email);
		}

		/// <summary>
		/// 修改密码（一级二级密码）
		/// </summary>
		public bool ResetPwd(string MemberAccount, string Pwd, string SecondPwd)
		{
			return dal.ResetPwd(MemberAccount, Pwd, SecondPwd);
		}

		/// <summary>
		/// 判断帐号+二级密码是否正確
		/// </summary>
		public bool AdminISSecondPwd(string MemberAccount, string SecondPwd)
		{
			return dal.AdminISSecondPwd(MemberAccount, SecondPwd);
		}

		#region  成员方法
		/// <summary>
		///  新增一条数据
		/// </summary>
		public bool Add(Sys_AdminInfo model)
		{
			bool result = dal.Add(model);
			base.WriteOperationLog(OperationType.Add, result, model.MemberAccount.ToString());
			return result;
		}

		/// <summary>
		///  保存一条数据
		/// </summary>
		public bool Update(Sys_AdminInfo model)
		{
			bool result = dal.Update(model);
			base.WriteOperationLog(OperationType.Update, result, model.MemberAccount.ToString());
			return result;
		}

		/// <summary>
		/// 删除一条数据
		///</summary>
		public bool Delete(String MemberAccount)
		{
			bool result = dal.Delete(MemberAccount);
			base.WriteOperationLog(OperationType.Delete, result, MemberAccount.ToString());
			return result;
		}

		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public Sys_AdminInfo Get(String MemberAccount)
		{
			return dal.Get(MemberAccount);
		}
		
		/// <summary>
		/// 得到一个JSON对象
		/// </summary>
		public string GetJson(String MemberAccount)
		{
			return Utility.GetJsonByObject(Get(MemberAccount));
		}

		/// <summary>
		/// 获得数据列表
		/// </summary>
		public DataSet Gets(string sqlWhere)
		{
			return dal.Gets(sqlWhere);
		}
		
		/// <summary>
		/// 获得前几行数据
		/// </summary>
		public DataSet Gets(int top, string sqlWhere, string filedOrder)
		{
			return dal.Gets(top, sqlWhere, filedOrder);
		}
		
		/// <summary>
		/// 获取记录总数
		/// </summary>
		public int GetRecordCount(string sqlWhere)
		{
			return dal.GetRecordCount(sqlWhere);
		}
		
		/// <summary>
		/// 获得数据列表分页
		/// </summary>
		public DataTable Gets(string sqlWhere, int pageindex, int pagesize, out int total, params SqlParameter[] cmdParms)
		{
			return dal.Gets(sqlWhere, pageindex, pagesize, out total, cmdParms);
		}

		/// <summary>
		/// 驗證用戶名是否已存在
		/// </summary>
		/// <param name="MemberAccount"></param>
		/// <returns></returns>
		public bool Exists(string MemberAccount)
		{
			if (string.IsNullOrEmpty(MemberAccount))
			{
				return false;
			}
			Sys_AdminInfo member = this.Get(MemberAccount);
			return member != null;
		}
		/// <summary>
		/// 获得数据列表分页
		/// </summary>
		public DataTable Gets(string sqlWhere, int pageindex, int pagesize, out int total, string sort, string order, params SqlParameter[] cmdParms)
		{
			return dal.Gets(sqlWhere, pageindex, pagesize, out total, sort, order, cmdParms);
		}

		/// <summary>
		/// 获取作业名称
		/// </summary>
		/// <returns></returns>
		public DataTable GetJobName()
		{
			return TypeHelper.ConvertToDataTable(dal.GetJobName());
		}
		#endregion  成员方法
	}
}


  